/*************************************************************************
	> File Name: P1077.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-03-03 11:16:09
 ************************************************************************/

#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

#define MAX_N 100
int dp[MAX_N + 5][MAX_N + 5];
int a[MAX_N + 5];

int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 0; i <= n; i++) dp[i][0] = 1;
    for (int i = 1; i <= n; i++) dp[i][0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            for (int k = 0; k <= min(a[i], j); k++) {
                dp[i][j] += dp[i - 1][j - k];
                dp[i][j] %= 1000007;
            }
        }
    }
    cout << dp[n][m] << endl;
    return 0;
}
